import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  // 登录
  {
    path: '/',
    name: 'login',
    component: () => import('@/views/login.vue'),
  },
  // 注册
  {
    path: '/regist',
    name: 'regist',
    component: () => import('@/views/regist.vue')
  },
  {
    path: '/index',
    name: 'index',
    component: () => import('@/views/index.vue'),
    redirectTo: "/index/recommend",
    children: [
      {
        path: 'recommend',
        name: 'recommend',
        meta: { title: '推荐' },
        component: () => import('@/views/app/recommend.vue')
      },
      {
        path: 'zhekou',
        name: 'zhekou',
        meta: { title: '3折疯抢' },
        component: () => import('@/views/app/zhekou.vue')
      },
      {
        path: 'weipin',
        name: 'weipin',
        meta: { title: '唯品快抢' },
        component: () => import('@/views/app/weipin.vue')
      },
      {
        path: 'luxury',
        name: 'luxury',
        meta: { title: '奢品' },
        component: () => import('@/views/app/luxury.vue')
      },
      {
        path: 'women',
        name: 'women',
        meta: { title: '女装' },
        component: () => import('@/views/app/women.vue')
      },
      {
        path: 'shoeBag',
        name: 'shoeBag',
        meta: { title: '鞋包' },
        component: () => import('@/views/app/shoeBag.vue')
      },
      {
        path: 'electric',
        name: 'electric',
        meta: { title: '电器' },
        component: () => import('@/views/app/electric.vue')
      },
      {
        path: 'accessory',
        name: 'accessory',
        meta: { title: '首饰' },
        component: () => import('@/views/app/accessory.vue')
      },
      {
        path: 'food',
        name: 'food',
        meta: { title: '食品' },
        component: () => import('@/views/app/food.vue')
      },
      {
        path: 'motherBaby',
        name: 'motherBaby',
        meta: { title: '母婴' },
        component: () => import('@/views/app/motherBaby.vue')
      },
      {
        path: 'BeautyMakeup',
        name: 'BeautyMakeup',
        meta: { title: '美妆' },
        component: () => import('@/views/app/BeautyMakeup.vue')
      },
      {
        path: 'manWear',
        name: 'manWear',
        meta: { title: '男装' },
        component: () => import('@/views/app/manWear.vue')
      },
      {
        path: 'homeTextil',
        name: 'homeTextil',
        meta: { title: '家纺' },
        component: () => import('@/views/app/homeTextil.vue')
      },
      {
        path: 'department',
        name: 'department',
        meta: { title: '百货' },
        component: () => import('@/views/app/department.vue')
      },
    ]
  },
  // 详情
  {
    path: '/header-detail',
    name: 'header-detail',
    component: () => import('@/views/header-detail.vue')
  },
  // 购物车
  {
    path: '/cart',
    name: 'cart',
    component: () => import('@/views/app/cart.vue'),
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
